package priv.ln.set.exer1;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

/**
 * ClassName: SetTest
 * Package: priv.ln.set.exer1
 * Description:
 * 定义方法如下：public static List duplicateList(List list)
 * 要求：① 参数List中只存放Integer的对象
 *      ② 在List内去除重复数字值，尽量简单
 * @Author 辣辣
 * @Create 2024/7/30 13:24
 * @Version 1.0
 */
public class SetTest {
    public static void main(String[] args) {
        ArrayList arrayList = new ArrayList();

        arrayList.add(22);
        arrayList.add(22);
        arrayList.add(24);
        arrayList.add(30);
        arrayList.add(25);
        arrayList.add(30);

        System.out.println(duplicateList(arrayList));

    }

    public static List duplicateList(List list){
        HashSet hashSet = new HashSet(list);
        ArrayList list1 = new ArrayList(hashSet);
        return list1;
    }

}
